﻿//变量管理器
//本文件由：贺镇涛（2021300004071）负责
#pragma once
#ifndef _SLLLIST
#define _SLLLIST
#include<string>
class SLLNode//节点，来自仿自Adam:《数据结构与算法》，清华大学出版社，第三版
{
public:
	SLLNode()
	{
		next = NULL;
		info = NULL;
	}
	SLLNode(const std::string& s_name, const std::string& s_info, SLLNode* in = NULL)
	{
		name = s_name;
		info = new std::string(s_info);
		next = in;
	}
	~SLLNode()
	{
		info->~basic_string();
	}
	std::string name;
	std::string* info;
	SLLNode* next;
};

class SLList
{
protected:
	SLLNode* head, * tail;
	int size;
public:
	SLList()
	{
		head = tail = NULL;
		size = 0;
	}
	~SLList();
	bool isEmpty()
	{
		return head == NULL;
	}
	void addToHead(std::string name, const std::string& s_info);
	void addToTail(std::string name, const std::string& s_info);
	std::string deleteFromHead();
	std::string deleteFromTail();
	std::string* get_valuePTR(const std::string& e1/*名字*/);
	void deleteNode(std::string name);
	bool isInlist(std::string name) const;
	int get_size();//输出总个数
};
#endif // SLLLIST